/**
 * @desc 用户信息模块
 * @author menguang
 * @date 2024-04-20
 */

export default {
	namespaced: true,
	state: {
		userInfo: {
			token: 'adasdasdasd',
			userName: 'admin'
		}
	},
	getters: {
		token: state => state.userInfo.token || '',
		userName: state => state.userInfo.userName || ''
	},
	mutations: {
		SET_USER_INFO(state, payload) {
			state.userInfo = payload;
		}
	},
	actions: {
		login({ commit }, payload) {
			commit('SET_USER_INFO', payload);
		},
		updateUserInfo({ commit }, payload) {
			commit('SET_USER_INFO', payload);
		},
		logout({ commit }) {
			commit('SET_USER_INFO', {});
		}
	}
};

